/*
 * msg.h
 *
 *  Created on: Oct 22, 2013
 *      Author: killerg
 */

#ifndef MSG_H_
#define MSG_H_


#define CREATE_MSG(ns, type, sub_type, sub_name)    \
        ns::type* ___msg = new ns::type;    \
        ___msg->set_id(ns::ID_##sub_type);  \
        auto sub_name = ___msg->mutable_##sub_name()

//#define SEND_MSG()  \
//        send(___msg);

#define CREATE_CL_CMSG(sub_type, sub_name)  \
        CREATE_MSG(cl, CMsg, sub_type, sub_name)

#define CREATE_CL_LMSG(sub_type, sub_name)  \
        CREATE_MSG(cl, LMsg, sub_type, sub_name)


#define CREATE_CS_CMSG(sub_type, sub_name)  \
        CREATE_MSG(cs, CMsg, sub_type, sub_name)

#define CREATE_CS_SMSG(sub_type, sub_name)  \
        CREATE_MSG(cs, SMsg, sub_type, sub_name)


#define CREATE_SL_SMSG(sub_type, sub_name)  \
        CREATE_MSG(sl, SMsg, sub_type, sub_name)

#define CREATE_SL_LMSG(sub_type, sub_name)  \
        CREATE_MSG(sl, LMsg, sub_type, sub_name)

#define CREATE_LA_LMSG(sub_type, sub_name)  \
        CREATE_MSG(la, LMsg, sub_type, sub_name)

#define CREATE_LA_AMSG(sub_type, sub_name)  \
        CREATE_MSG(la, AMsg, sub_type, sub_name)

#define CREATE_SB_SMSG(sub_type, sub_name)  \
        CREATE_MSG(sb, SMsg, sub_type, sub_name)

#define CREATE_SB_BMSG(sub_type, sub_name)  \
        CREATE_MSG(sb, BMsg, sub_type, sub_name)



#endif /* MSG_H_ */
